﻿Shader "Unlit/PrograssBar"
{
	Properties
	{
		_BackGroundColor("BackGroundColor",Color) = (0,0,0,0)
		_BarColor("BarColor",Color) = (1,1,1,1)
		_Prograss("Prograss",float) = 0
	}
		SubShader
	{
		Tags { "RenderType" = "Opaque" }
		LOD 100

		Pass
		{
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			// make fog work
			#pragma multi_compile_fog

			#include "UnityCG.cginc"

			float4 _BackgroundColor;
			float4 _BarColor;
			float _Prograss;

			struct appdata
			{
				float4 vertex : POSITION;
				float2 uv : TEXCOORD0;
			};

			struct v2f
			{
				float4 vertex : SV_POSITION;
				float2 uv : TEXCOORD0;
			};

			float4 _MainTex_ST;
			
			v2f vert (appdata v)
			{
				v2f o;
				o.vertex = UnityObjectToClipPos(v.vertex);
				o.uv = v.uv;
				return o;
			}
			
			fixed4 frag (v2f i) : SV_Target
			{
				fixed4 col = i.uv.y > _Prograss ? _BackgroundColor : _BarColor;
				return col;
			}
			ENDCG
		}
	}
}
